<?php


namespace app\cms\admin\controller\merchant;

// 商户商品管理
use app\cms\model\merchant\goods\goodsModel;
use iflow\Response;
use iflow\Router\Controller;
use iflow\Router\implement\Request\{ GetMapping, PostMapping };

#[Controller('%cmsAdmin%/merchant_shop')]
class merchantShop
{
    /**
     * 查询商品
     * @param int $goods_id
     * @return Response
     */
    #[GetMapping]
    public function get(int $goods_id): Response
    {
        return (new goodsModel()) -> getGoodsInfo($goods_id);
    }

    /**
     * 下架、上架 商品
     * @param int $goods_id
     * @param string $ban_goods_desc
     * @return Response
     */
    #[PostMapping]
    public function banOrUnblockMerchShop(int $goods_id, string $ban_goods_desc): Response
    {
        return (new goodsModel()) -> banOrUnblockMerchShop($goods_id, $ban_goods_desc);
    }

    /**
     * 获取商品列表
     * @param string $goods_name
     * @param int $goods_group_id
     * @param int $merchant_id
     * @return Response
     */
    #[GetMapping]
    public function getGoodsList(
        string $goods_name = '', int $goods_group_id = 0, int $merchant_id = 0
    ): Response {
        return (new goodsModel()) -> getGoodsList(
            $goods_name, $goods_group_id, $merchant_id
        );
    }
}